<template>
  <div>
    son2 page<br />
    <button @click="increment">increment</button><button @click="increment2(2)">increment2</button
    ><button @click="increment3({ amount: 3 })">increment3</button>
    <hr />
    当前登录人是：{{ $store.state.user.loginName }} <br />
    <input v-model="loginName" @keyup.enter="login({ loginName: loginName })" />
    <button @click="login({ loginName: loginName })">登录</button><button @click="loginOut">退出</button>
    <hr />
    当前app是：{{ appName }} ; 是第{{ $store.state.app.appVersion }}代机型；
  </div>
</template>

<script>
import { mapActions, mapMutations, mapGetters } from 'vuex'
export default {
  name: 'Son2',
  data() {
    return {
      loginName: '',
    }
  },
  computed: {
    ...mapGetters({
      appName: 'app/getAppName',
    }),
  },
  methods: {
    ...mapMutations(['login', 'loginOut']),
    ...mapActions(['increment', 'increment2', 'increment3']),
    // increment() {
    //   this.$store.dispatch('increment')
    // },
    // increment2() {
    //   this.$store.dispatch('increment2', 2)
    // },
    // increment3() {
    //   this.$store.dispatch('increment3', {
    //     amount: 3,
    //   })
    // },
  },
}
</script>

<style lang="scss" scoped></style>
